<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小票打印</title>
    <style type="text/css">
        body{
            margin: 0;
            padding: 0;
        }
        p {
            font-size: 2px;
        }
    </style>
    <script language="javascript" src="/LodopFuncs.js"></script>
    <object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> 
    <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
    </object>
</head>
<body onload="aa()">
<div id="div1">
<p style="font-size: 10px;margin-left: 20px;">${order.cate}</p>
<p style="font-size: 10px;margin-left: 20px;">${order.mansion}${order.tower}</p>
<p style="font-size: 10px;margin-left: 20px;">收货人：${order.consignee}</p>
<p style="font-size: 10px;margin-left: 20px;">手机号：${order.mobile}</p>
<p style="font-size: 10px;margin-left: 20px;">地址：${order.site}</p>
<p style="font-size: 10px;margin-left: 20px;">送达时间：${order.deliveryPeriod}</p>
<p style="font-size: 10px;margin-left: 20px;">提供商：${order.provider}</p>
</div>

<script language="javascript">
    function aa(){
        var str = document.getElementById("div1").innerHTML;
        setTimeout(function(){
            var LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
            setTimeout(function(){
                LODOP.PRINT_INIT("");
                LODOP.SET_PRINT_PAGESIZE(1,"58mm","58mm","");
                LODOP.SET_PRINT_COPIES(1);
                LODOP.ADD_PRINT_HTM("20", "20", "RightMargin:1mm", "BottomMargin:20", str);
                // LODOP.PREVIEW();
                LODOP.PRINT();
                setTimeout(function () {
                    location.href = '/order/print?id=${order.id}';
                },1000);
            },"500");  //500毫秒后执行print()函数，只执行一次。
        },"500")
    }
</script>
</body>
</html>